package com.tanjor.sys.dubbo.impl;

import java.io.Serializable;
import javax.annotation.Resource;

import java.util.List;
import java.util.Map;

import com.tanjor.sys.dubbo.dto.SysMenuDTO;
import com.tanjor.sys.service.interfaces.ISysMenuService;
import com.tanjor.sys.service.interfaces.ISysRoleMenuService;
import com.tanjor.sys.dubbo.impl.interfaces.ISysMenuDubbo;

import com.tanjor.common.datatable.PageReq;
import com.tanjor.common.datatable.PageResp;
import com.tanjor.common.exception.BusinessException;

import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  dubbo服务实现类
 * </p>
 *
 * @author Liuwy
 * @since 2017-04-02
 */
@Transactional
public class SysMenuDubboImpl implements ISysMenuDubbo{
	
	@Resource(name="SysMenuServiceImpl")
	private ISysMenuService service;
	
	@Resource(name="SysRoleMenuServiceImpl")
	private ISysRoleMenuService sysRoleMenuService;
		
	@Override
	public PageResp findPage(PageReq pageReq) {
		// TODO Auto-generated method stub
		return service.findPage(pageReq);
	}
	
	@Override
	public Map<String,Object> insert(SysMenuDTO entityDTO) throws BusinessException{
		// TODO Auto-generated method stub	
		return service.insert(entityDTO);
	}
	
	@Override
	public Map<String,Object> update(SysMenuDTO entityDTO) throws BusinessException{
		// TODO Auto-generated method stub
		return service.update(entityDTO);
	}	
	
	@Override
	public Map<String, Object> deleteById(Serializable id) throws BusinessException{
		// TODO Auto-generated method stub
		return service.delById(id);
	}
	
	@Override
	public SysMenuDTO findById(Serializable id){
		// TODO Auto-generated method stub
		return service.findById(id);
	}

	@Override
	public List<Map<String, Object>> findByRole(String roleId) {
		// TODO Auto-generated method stub
		return service.findByRole(roleId);
	}

	@Override
	public List<Map<String, Object>> findTreeByRole(String roleCode) {
		// TODO Auto-generated method stub
		return service.findTreeByRole(roleCode);
	}

	@Override
	public List<Map<String, Object>> findTopTree() {
		// TODO Auto-generated method stub
		return service.findTopTree();
	}

	@Override
	public List<SysMenuDTO> findAllMenus() {
		// TODO Auto-generated method stub
		return service.findAllMenus();
	}
	
	@Override
	public Map<String, Object> saveRoleMenus(String roleCode, String menuIds) throws BusinessException {
		// TODO Auto-generated method stub		
		return sysRoleMenuService.insert(roleCode, menuIds);
	}

	
}
